package aqiang9.crypt;

import javax.crypto.NoSuchPaddingException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;

/**
 * DES 加密
 * @author aqiang9  2020-06-19
 */
public class DesAesDemo {
    public static void main(String[] args) throws NoSuchPaddingException, NoSuchAlgorithmException {
//       String input = "aqiang" ;
//       String key = "1234" ;
//       String algorithm = "DES" ;
//       String transformation = "DES" ;
//
//        Cipher instance = Cipher.getInstance(transformation);

        Base64.Decoder decoder = Base64.getDecoder();
        Base64.Encoder encoder = Base64.getEncoder();
        byte[] encode = encoder.encode("abc".getBytes());
        System.out.println(new String(encode));
        byte[] decode = decoder.decode(encode);
        System.out.println(new String( decode ) );

    }
}
